<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <script src="/scripts/jquery.js"></script>
    <title></title>
    <link href="/styles/common.css" rel="stylesheet" type="text/css"/>
	<style>
	#add{
		display:block;
		padding:0 0 0 100px;
	}
		.user_div{
			padding:10px 0 0 100px;
		}
		.user_div .one_line{
			float:left;
			height:40px;
			width:900px;
		}
		.user_div .one_line div{
			float:left ;
			padding:5px 0 0 0 ;
			width:200px;
			border:1px solid #CCCCCC;
			height:20px;
			
		}
		.user_div .one_line div a{
			margin:0 0 0 10px;
		}
	</style>
  </head>

  <body>
  	<a href="/userMan/adduserpage.action" id="add">新增</a>
  	<div class="user_div">
  		<div class="one_line">
  			<div>ID</div>
  			<div>编号</div>
  			<div>姓名</div>
  			<div>操作</div>
  		</div>
  		<c:forEach var="user" items="${users}">
  			<div class="one_line">
	  			<div><c:out value="${user.id}" /></div>
	  			<div><c:out value="${user.systemNumber}" /></div>
	  			<div><c:out value="${user.userName}" /></div>
	  			<div><a href="/userMan/adduserpage.action?userId=<c:out value="${user.id}" />">查看</a><a href="/userMan/adduser.action?userId=<c:out value="${user.id}" />">角色</a><a href="#" class="delUser">删除</a></div>
  			</div>
  		</c:forEach>
  	</div>
  </body>
</html>
<script type="text/javascript">
$(document).ready(function(){
	$(".delUser").click(function(){
		delUser($(this).parent().parent());
		return false;
	});
})
function delUser(line_dom){
	var id = $(line_dom).find("div").eq(0).text();
	$.ajax({
		type:"POST",
		data:{"userId":id},
		url:"/userajax/delUser",
		success:function(msg){
			var data = eval("("+msg+")");
			if(data.status){
				$(line_dom).slideUp(function(){
					$(this).remove();
				});
			}else{
				alert(data.meg);
			} 
		},
	});
}
</script>
